
const subTableFormOptions = vm => ({
    <#if multiSub == true>
        <#if itemList??>
            <#list itemList as item>
                <#assign tableItemName = item.tableItemName>
                <#assign fieldItemData = item.fieldItemData>
                ${tableItemName}: [
                { type: 'a-input', key: 'id', hidden: true },
                <#list fieldItemData as itemData>
                <#assign fieldName = itemData.dbFieldName>
                <#assign fieldShowName = itemData.fieldShowName>
                <#assign isShowList = itemData.isShowList>
                <#assign isShowForm = itemData.isShowForm>
                <#assign fieldShowType = itemData.fieldShowType>
                <#assign fieldMustInput = itemData.fieldMustInput>
                <#assign dictOriginType = itemData.dictOriginType>
                <#assign dictKey = itemData.dictKey>
                <#assign dictCode = itemData.dictField>
                <#if isShowForm == true &&  fieldShowType?has_content>
                    <#switch fieldShowType>
                    <#--            // 文本框-->
                        <#case "1">
                            {
                                title: '${fieldShowName}',
                                key: '${fieldName}',
                                type: 'a-input',
                                <#if fieldMustInput == true>
                                rules: [{ required: true, message: '请输入${fieldShowName}' }],
                                </#if>
                                options: {
                                    props: {
                                        placeholder: '请输入${fieldShowName}',
                                    }
                                },
                            },
                            <#break>
                        <#-- 单选框-->
                        <#case "2">
                        <#if dictOriginType == "1">
                            {
                                title: '${fieldShowName}',
                                key: '${fieldName}',
                                type: 'h-dict-radio',
                                <#if fieldMustInput == true>
                                rules: [{ required: true, message: '请选择${fieldShowName}' }],
                                </#if>
                                options: {
                                    props: {
                                        dictCode: "${dictCode}",
                                        placeholder: '请选择${fieldShowName}',
                                    },
                                    on: {
                                        change: (value, options) => {
                                            vm.model.${fieldName}_dictText = (options.find(v => v.key === value) || {}).label
                                        }
                                    }
                                },
                            },
                            {key: "${fieldName}_dictText", hidden: true, type: "a-input"},
                        </#if>
                        <#if dictOriginType == "2">
                            {
                                title: '${fieldShowName}',
                                key: '${fieldName}',
                                type: 'h-radio',
                                <#if fieldMustInput == true>
                                rules: [{ required: true, message: '请选择${fieldShowName}' }],
                                </#if>
                                options: {
                                    props: {
                                        placeholder: `请选择${fieldShowName}`,
                                        options: [],
                                    },
                                    on: {
                                        change: (value, options) => {
                                            vm.model.${fieldName}_realText = options && options.length ? options[0].label : undefined
                                        }
                                    }
                                },
                            },
                            {key: "${fieldName}_realText", hidden: true, type: "a-input"},
                            </#if>
                            <#break>
                        <#-- // 多选框-->
                        <#case "3">
                        <#if dictOriginType == "1">
                            {
                                title: '${fieldShowName}',
                                key: '${fieldName}',
                                type: 'h-dict-checkbox',
                                <#if fieldMustInput == true>
                                    rules: [{ required: true, message: '请选择${fieldShowName}' }],
                                </#if>
                                options: {
                                    props: {
                                        dictCode: "${dictCode}",
                                        options: [],
                                    },
                                    on: {
                                        change: (value, options) => {
                                            vm.model.${fieldName}_dictText = options && options.length ? options.map(item => item.title || item.label).join(',') : undefined
                                        },
                                    }
                                },
                            },
                            {key: "${fieldName}_dictText", hidden: true, type: "a-input"},
                        </#if>
                        <#if dictOriginType == "2">
                            {
                                title: '${fieldShowName}',
                                key: '${fieldName}',
                                type: 'h-checkbox',
                                <#if fieldMustInput == true>
                                    rules: [{ required: true, message: '请选择${fieldShowName}' }],
                                </#if>
                                options: {
                                    props: {
                                        options: [],
                                    },
                                    on: {
                                        change: (value, options) => {
                                            vm.model.${fieldName}_realText = options && options.length ? options.map(item => item.title || item.label).join(',') : undefined
                                        }
                                    }
                                },
                            },
                            {key: "${fieldName}_realText", hidden: true, type: "a-input"},
                        </#if>
                            <#break>
                        <#--                // 日期(yyyy-MM-dd)-->
                        <#case "5">
                    {
                        title: '${fieldShowName}',
                        key: '${fieldName}',
                        type: 'h-date-picker',
                        <#if fieldMustInput == true>
                        rules: [{ required: true, message: '请选择${fieldShowName}' }],
                        </#if>
                        options: {
                            props: {
                                format:"YYYY-MM-DD",
                                valueFormat:"YYYY-MM-DD",
                                placeholder: "请选择${fieldShowName}",
                            }
                        },
                    },
                    <#break>
                    <#--                // 日期(yyyy)-->
                    <#case "6">
                    {
                        title: '${fieldShowName}',
                        key: '${fieldName}',
                        type: 'h-year-picker',
                        <#if fieldMustInput == true>
                            rules: [{ required: true, message: '请选择${fieldShowName}' }],
                        </#if>
                        options: {
                            props:{
                                placeholder: "请选择${fieldShowName}",
                            },
                            style: {
                                width: '100%',
                            },
                        },
                    },
                    <#break>
                    <#--                // 日期(yyyy-MM-dd HH:mm:ss)-->
                    <#case "7">
                    {
                        title: '${fieldShowName}',
                        key: '${fieldName}',
                        type: 'h-date-picker',
                        <#if fieldMustInput == true>
                        rules: [{ required: true, message: '请选择${fieldShowName}' }],
                        </#if>
                        options: {
                            props: {
                                showTime: true,
                                format:"YYYY-MM-DD HH:mm:ss",
                                valueFormat:"YYYY-MM-DD HH:mm:ss",
                                placeholder: "请选择${fieldShowName}",
                            },
                            style: {
                                width: '100%',
                            },
                        },
                    },
                    <#break>
                        <#--                // 多行文本-->
                        <#case "8">
                            {
                                title: '${fieldShowName}',
                                key: '${fieldName}',
                                type: 'a-textarea',
                                span: 2,
                                <#if fieldMustInput == true>
                                    rules: [{ required: true, message: '请输入${fieldShowName}' }],
                                </#if>
                                options: {
                                   props: {
                                     placeholder: '请输入${fieldShowName}',
                                   }
                                },
                            },
                            <#break>
                        <#--                // 文件-->
                        <#case "9">
                            {
                                title: '${fieldShowName}',
                                key: '${fieldName}',
                                type: 'h-upload-file',
                                span: 2,
                                <#if fieldMustInput == true>
                                    rules: [{ required: true, message: '请上传${fieldShowName}' }],
                                </#if>
                                options: {
                                    props: {
                                         showSecretLevel: true,
                                    },
                                    scopedSlots: {
                                        secretLevel: ({row, $upload}) => vm.$createElement("h-dict-select-user", {
                                            props: {
                                                value: row.secretLevel,
                                            },
                                            on: {
                                                change: (value) => {
                                                    row.secretLevel = value;
                                                    $upload.triggerChange();
                                                },
                                            },
                                        }),
                                    },
                                },
                            },
                            <#break>
                        <#--                // 下拉框-->
                        <#case "10">
                        <#if dictOriginType == "1">
                            {
                                title: '${fieldShowName}',
                                key: '${fieldName}',
                                type: 'h-dict-select',
                                <#if fieldMustInput == true>
                                    rules: [{ required: true, message: '请选择${fieldShowName}' }],
                                </#if>
                                options: {
                                    props: {
                                        dictCode: "${dictCode}",
                                        options: [],
                                    },
                                    on: {
                                        change: (value, options) => {
                                            vm.model.${fieldName}_dictText = options.label || options.title
                                        },
                                    }
                                },
                            },
                            {key: "${fieldName}_dictText", hidden: true, type: "a-input"},
                        </#if>
                        <#if dictOriginType == "2">
                            {
                                title: '${fieldShowName}',
                                key: '${fieldName}',
                                type: 'h-select',
                                <#if fieldMustInput == true>
                                    rules: [{ required: true, message: '请选择${fieldShowName}' }],
                                </#if>
                                options: {
                                    props: {
                                        options: [],
                                    },
                                    on: {
                                        change: (value, options) => {
                                            vm.model.${fieldName}_realText = options.label || options.title
                                        },
                                    }
                                },
                            },
                            {key: "${fieldName}_realText", hidden: true, type: "a-input"},
                        </#if>
                            <#break>
                        <#--                // 下拉多选-->
                        <#case "11">
                        <#if dictOriginType == "1">
                            {
                                title: '${fieldShowName}',
                                key: '${fieldName}',
                                type: 'h-dict-select',
                                <#if fieldMustInput == true>
                                    rules: [{ required: true, message: '请选择${fieldShowName}' }],
                                </#if>
                                options: {
                                    props: {
                                        mode: "multiple",
                                        dictCode: "${dictCode}",
                                    },
                                    on: {
                                        change: (value, options) => {
                                            vm.model.${fieldName}_dictText = options && options.length ? options.map(item => item.itemValue).join(',') : undefined
                                        },
                                    }
                                },
                            },
                            {key: "${fieldName}_dictText", hidden: true, type: "a-input"},
                        </#if>
                        <#if dictOriginType == "2">
                            {
                                title: '${fieldShowName}',
                                key: '${fieldName}',
                                type: 'h-select',
                                <#if fieldMustInput == true>
                                    rules: [{ required: true, message: '请选择${fieldShowName}' }],
                                </#if>
                                options: {
                                    props: {
                                        mode: "multiple",
                                        options: [],
                                    },
                                    on: {
                                        change: (value, options) => {
                                            vm.model.${fieldName}_realText = options && options.length ? options.map(item => item.title || item.label).join(',') : undefined
                                        },
                                    }
                                },
                            },
                            {key: "${fieldName}_realText", hidden: true, type: "a-input"},
                        </#if>
                            <#break>
                        <#--                // 数值-->
                        <#case "12">
                            {
                                title: '${fieldShowName}',
                                key: '${fieldName}',
                                type: 'a-input-number',
                                <#if fieldMustInput == true>
                                    rules: [{ required: true, message: '请输入${fieldShowName}' }],
                                </#if>
                                options: {
                                    props: {
                                        placeholder: '请输入${fieldShowName}',
                                    },
                                    style: {
                                        width: '100%'
                                    }
                                },
                            },
                            <#break>
                        <#--                // 人员选择-->
                        <#case "13">
                            {
                            title: '${fieldShowName}',
                            key: '${fieldName}',
                            type: 'sysUserSelect',
                            <#if fieldMustInput == true>
                                rules: [{ required: true, message: '请选择${fieldShowName}' }],
                            </#if>
                            options: {
                               props: {
                                 placeholder: `请选择${fieldShowName}`,
                               },
                                on: {
                                    change: (value, options) => {
                                            vm.model.${fieldName}_realText = options.idName
                                        },
                                    },
                                },
                            },
                        {key: "${fieldName}_realText", hidden: true, type: "a-input"},
                            <#break>
                        <#--                // 部门选择-->
                        <#case "14">
                            {
                                title: '${fieldShowName}',
                                key: '${fieldName}',
                                type: 'HDepartSelect',
                                <#if fieldMustInput == true>
                                    rules: [{ required: true, message: '请选择${fieldShowName}' }],
                                </#if>
                                options: {
                                    props: {
                                      placeholder: `请选择${fieldShowName}`,  
                                    },
                                    on: {
                                        change: (value, options) => {
                                            vm.model.${fieldName}_realText = options.deptName
                                        },
                                    }
                                },
                            },
                        {key: "${fieldName}_realText", hidden: true, type: "a-input"},
                            <#break>
                             <#--                // 人员密级选择-->
                        <#case "15">
                            {
                                title: '${fieldShowName}',
                                key: '${fieldName}',
                                type: 'h-dict-select-user',
                                <#if fieldMustInput == true>
                                    rules: [{ required: true, message: '请选择${fieldShowName}' }],
                                </#if>
                                options: {
                                    props: {
                                        placeholder: `请选择${fieldShowName}`,
                                    },
                                    on: {
                                        change: (value, options) => {
                                            vm.model.${fieldName}_dictText = options.label || options.title
                                        },
                                    }
                                },
                            },
                            {key: "${fieldName}_dictText", hidden: true, type: "a-input"},
                        <#break>
                    </#switch>
                </#if>
                </#list>
                ],
            </#list>
        </#if>
    </#if>
    <#if multiSub == false>
        default : [
        { type: 'a-input', key: 'id', hidden: true },
        <#list fieldItemData as itemData>
            <#assign fieldName = itemData.dbFieldName>
            <#assign fieldShowName = itemData.fieldShowName>
            <#assign isShowList = itemData.isShowList>
            <#assign isShowForm = itemData.isShowForm>
            <#assign fieldShowType = itemData.fieldShowType>
            <#assign fieldMustInput = itemData.fieldMustInput>
            <#assign dictOriginType = itemData.dictOriginType>
            <#assign dictKey = itemData.dictKey>
            <#assign dictCode = itemData.dictField>
            <#if isShowForm == true &&   fieldShowType?has_content>
                <#switch fieldShowType>
                <#--            // 文本框-->
                        <#case "1">
                            {
                                title: '${fieldShowName}',
                                key: '${fieldName}',
                                type: 'a-input',
                                <#if fieldMustInput == true>
                                rules: [{ required: true, message: '请输入${fieldShowName}' }],
                                </#if>
                                options: {
                                    props: {
                                        placeholder: '请输入${fieldShowName}',
                                    }
                                },
                            },
                            <#break>
                        <#-- 单选框-->
                        <#case "2">
                        <#if dictOriginType == "1">
                            {
                                title: '${fieldShowName}',
                                key: '${fieldName}',
                                type: 'h-dict-radio',
                                <#if fieldMustInput == true>
                                rules: [{ required: true, message: '请选择${fieldShowName}' }],
                                </#if>
                                options: {
                                    props: {
                                        dictCode: "${dictCode}",
                                        placeholder: '请选择${fieldShowName}',
                                    },
                                    on: {
                                        change: (value, options) => {
                                            vm.model.${fieldName}_dictText = (options.find(v => v.key === value) || {}).label
                                        }
                                    }
                                },
                            },
                            {key: "${fieldName}_dictText", hidden: true, type: "a-input"},
                        </#if>
                        <#if dictOriginType == "2">
                            {
                                title: '${fieldShowName}',
                                key: '${fieldName}',
                                type: 'h-radio',
                                <#if fieldMustInput == true>
                                rules: [{ required: true, message: '请选择${fieldShowName}' }],
                                </#if>
                                options: {
                                    props: {
                                        placeholder: `请选择${fieldShowName}`,
                                        options: [],
                                    },
                                    on: {
                                        change: (value, options) => {
                                            vm.model.${fieldName}_realText = options && options.length ? options[0].label : undefined
                                        }
                                    }
                                },
                            },
                            {key: "${fieldName}_realText", hidden: true, type: "a-input"},
                            </#if>
                            <#break>
                        <#-- // 多选框-->
                        <#case "3">
                        <#if dictOriginType == "1">
                            {
                                title: '${fieldShowName}',
                                key: '${fieldName}',
                                type: 'h-dict-checkbox',
                                <#if fieldMustInput == true>
                                    rules: [{ required: true, message: '请选择${fieldShowName}' }],
                                </#if>
                                options: {
                                    props: {
                                        dictCode: "${dictCode}",
                                        options: [],
                                    },
                                    on: {
                                        change: (value, options) => {
                                            vm.model.${fieldName}_dictText = options && options.length ? options.map(item => item.title || item.label).join(',') : undefined
                                        },
                                    }
                                },
                            },
                            {key: "${fieldName}_dictText", hidden: true, type: "a-input"},
                        </#if>
                        <#if dictOriginType == "2">
                            {
                                title: '${fieldShowName}',
                                key: '${fieldName}',
                                type: 'h-checkbox',
                                <#if fieldMustInput == true>
                                    rules: [{ required: true, message: '请选择${fieldShowName}' }],
                                </#if>
                                options: {
                                    props: {
                                        options: [],
                                    },
                                    on: {
                                        change: (value, options) => {
                                            vm.model.${fieldName}_realText = options && options.length ? options.map(item => item.title || item.label).join(',') : undefined
                                        }
                                    }
                                },
                            },
                            {key: "${fieldName}_realText", hidden: true, type: "a-input"},
                        </#if>
                            <#break>
                        <#--                // 日期(yyyy-MM-dd)-->
                        <#case "5">
                    {
                        title: '${fieldShowName}',
                        key: '${fieldName}',
                        type: 'h-date-picker',
                        <#if fieldMustInput == true>
                        rules: [{ required: true, message: '请选择${fieldShowName}' }],
                        </#if>
                        options: {
                            props: {
                                format:"YYYY-MM-DD",
                                valueFormat:"YYYY-MM-DD",
                                placeholder: "请选择${fieldShowName}",
                            }
                        },
                    },
                    <#break>
                    <#--                // 日期(yyyy)-->
                    <#case "6">
                    {
                        title: '${fieldShowName}',
                        key: '${fieldName}',
                        type: 'h-year-picker',
                        <#if fieldMustInput == true>
                            rules: [{ required: true, message: '请选择${fieldShowName}' }],
                        </#if>
                        options: {
                            props:{
                                placeholder: "请选择${fieldShowName}",
                            }
                        },
                    },
                    <#break>
                    <#--                // 日期(yyyy-MM-dd HH:mm:ss)-->
                    <#case "7">
                    {
                        title: '${fieldShowName}',
                        key: '${fieldName}',
                        type: 'h-date-picker',
                        <#if fieldMustInput == true>
                        rules: [{ required: true, message: '请选择${fieldShowName}' }],
                        </#if>
                        options: {
                            props: {
                                showTime: true,
                                format:"YYYY-MM-DD HH:mm:ss",
                                valueFormat:"YYYY-MM-DD HH:mm:ss",
                                placeholder: "请选择${fieldShowName}",
                            }
                        },
                    },
                    <#break>
                        <#--                // 多行文本-->
                        <#case "8">
                            {
                                title: '${fieldShowName}',
                                key: '${fieldName}',
                                type: 'a-textarea',
                                span: 2,
                                <#if fieldMustInput == true>
                                    rules: [{ required: true, message: '请输入${fieldShowName}' }],
                                </#if>
                                options: {
                                   props: {
                                     placeholder: '请输入${fieldShowName}',
                                   }
                                },
                            },
                            <#break>
                        <#--                // 文件-->
                        <#case "9">
                            {
                                title: '${fieldShowName}',
                                key: '${fieldName}',
                                type: 'h-upload-file',
                                span: 2,
                                <#if fieldMustInput == true>
                                    rules: [{ required: true, message: '请上传${fieldShowName}' }],
                                </#if>
                                options: {
                                    props: {
                                         showSecretLevel: true,
                                    },
                                    scopedSlots: {
                                        secretLevel: ({row, $upload}) => vm.$createElement("h-dict-select-user", {
                                            props: {
                                                value: row.secretLevel,
                                            },
                                            on: {
                                                change: (value) => {
                                                    row.secretLevel = value;
                                                    $upload.triggerChange();
                                                },
                                            },
                                        }),
                                    },
                                },
                            },
                            <#break>
                        <#--                // 下拉框-->
                        <#case "10">
                        <#if dictOriginType == "1">
                            {
                                title: '${fieldShowName}',
                                key: '${fieldName}',
                                type: 'h-dict-select',
                                <#if fieldMustInput == true>
                                    rules: [{ required: true, message: '请选择${fieldShowName}' }],
                                </#if>
                                options: {
                                    props: {
                                        dictCode: "${dictCode}",
                                        options: [],
                                    },
                                    on: {
                                        change: (value, options) => {
                                            vm.model.${fieldName}_dictText = options.label || options.title
                                        },
                                    }
                                },
                            },
                            {key: "${fieldName}_dictText", hidden: true, type: "a-input"},
                        </#if>
                        <#if dictOriginType == "2">
                            {
                                title: '${fieldShowName}',
                                key: '${fieldName}',
                                type: 'h-select',
                                <#if fieldMustInput == true>
                                    rules: [{ required: true, message: '请选择${fieldShowName}' }],
                                </#if>
                                options: {
                                    props: {
                                        options: [],
                                    },
                                    on: {
                                        change: (value, options) => {
                                            vm.model.${fieldName}_realText = options.label || options.title
                                        },
                                    }
                                },
                            },
                            {key: "${fieldName}_realText", hidden: true, type: "a-input"},
                        </#if>
                            <#break>
                        <#--                // 下拉多选-->
                        <#case "11">
                        <#if dictOriginType == "1">
                            {
                                title: '${fieldShowName}',
                                key: '${fieldName}',
                                type: 'h-dict-select',
                                <#if fieldMustInput == true>
                                    rules: [{ required: true, message: '请选择${fieldShowName}' }],
                                </#if>
                                options: {
                                    props: {
                                        mode: "multiple",
                                        dictCode: "${dictCode}",
                                    },
                                    on: {
                                        change: (value, options) => {
                                            vm.model.${fieldName}_dictText = options && options.length ? options.map(item => item.itemValue).join(',') : undefined
                                        },
                                    }
                                },
                            },
                            {key: "${fieldName}_dictText", hidden: true, type: "a-input"},
                        </#if>
                        <#if dictOriginType == "2">
                            {
                                title: '${fieldShowName}',
                                key: '${fieldName}',
                                type: 'h-select',
                                <#if fieldMustInput == true>
                                    rules: [{ required: true, message: '请选择${fieldShowName}' }],
                                </#if>
                                options: {
                                    props: {
                                        mode: "multiple",
                                        options: [],
                                    },
                                    on: {
                                        change: (value, options) => {
                                            vm.model.${fieldName}_realText = options && options.length ? options.map(item => item.title || item.label).join(',') : undefined
                                        },
                                    }
                                },
                            },
                            {key: "${fieldName}_realText", hidden: true, type: "a-input"},
                        </#if>
                            <#break>
                        <#--                // 数值-->
                        <#case "12">
                            {
                                title: '${fieldShowName}',
                                key: '${fieldName}',
                                type: 'a-input-number',
                                <#if fieldMustInput == true>
                                    rules: [{ required: true, message: '请输入${fieldShowName}' }],
                                </#if>
                                options: {
                                    props: {
                                        placeholder: '请输入${fieldShowName}',
                                    },
                                    style: {
                                        width: '100%'
                                    }
                                },
                            },
                            <#break>
                        <#--                // 人员选择-->
                        <#case "13">
                            {
                            title: '${fieldShowName}',
                            key: '${fieldName}',
                            type: 'sysUserSelect',
                            <#if fieldMustInput == true>
                                rules: [{ required: true, message: '请选择${fieldShowName}' }],
                            </#if>
                            options: {
                               props: {
                                 placeholder: `请选择${fieldShowName}`,
                               },
                                on: {
                                    change: (value, options) => {
                                            vm.model.${fieldName}_realText = options.idName
                                        },
                                    },
                                },
                            },
                        {key: "${fieldName}_realText", hidden: true, type: "a-input"},
                            <#break>
                        <#--                // 部门选择-->
                        <#case "14">
                            {
                                title: '${fieldShowName}',
                                key: '${fieldName}',
                                type: 'HDepartSelect',
                                <#if fieldMustInput == true>
                                    rules: [{ required: true, message: '请选择${fieldShowName}' }],
                                </#if>
                                options: {
                                    props: {
                                      placeholder: `请选择${fieldShowName}`,  
                                    },
                                    on: {
                                        change: (value, options) => {
                                            vm.model.${fieldName}_realText = options.deptName
                                        },
                                    }
                                },
                            },
                        {key: "${fieldName}_realText", hidden: true, type: "a-input"},
                            <#break>
                            <#case "15">
                            {
                                title: '${fieldShowName}',
                                key: '${fieldName}',
                                type: 'h-dict-select-user',
                                <#if fieldMustInput == true>
                                    rules: [{ required: true, message: '请选择${fieldShowName}' }],
                                </#if>
                                options: {
                                    props: {
                                        placeholder: `请选择${fieldShowName}`,
                                    },
                                    on: {
                                        change: (value, options) => {
                                            vm.model.${fieldName}_dictText = options.label || options.title
                                        },
                                    }
                                },
                            },
                            {key: "${fieldName}_dictText", hidden: true, type: "a-input"},
                        <#break>
                </#switch>
            </#if>
        </#list>
        ],
    </#if>
})

// 业务字段表单动态下拉数据源配置
export const busiFieldFormSelectConfig = [
    <#list fieldData as item>
    <#assign fieldName = item.dbFieldName>
    <#assign dictOriginType = item.dictOriginType>
    <#assign dictTable = item.dictTable>
    <#assign dictField = item.dictField>
    <#assign dictText = item.dictText>
    <#if dictOriginType == "2">
        { dictTable: "${dictTable}", dictField: "${dictField}", dictText: "${dictText}", optionKey: "${fieldName}" },
    </#if>
    </#list>
]

export const busiFieldSearchSelectConfig = [
    <#list fieldData as item>
    <#assign fieldName = item.dbFieldName>
    <#assign dictField = item.dictField>
    <#assign fieldShowType = item.fieldShowType>
    <#assign dictText = item.dictText>
    <#if fieldShowType == "13">
        { isUser: true, dictField: "id", dictText: "id_name", optionKey: "${fieldName}" },
    </#if>
    <#if fieldShowType == "14">
        { isDept: true, dictField: "id", dictText: "dept_name", optionKey: "${fieldName}" },
    </#if>
    </#list>
]

const tabPane = [
    <#if multiSub == true>
        <#if itemList??>
            <#list itemList as item>
                <#assign tableItemName = item.tableItemName>
                <#assign tableTxt = item.tableTxt>
                <#assign fieldItemData = item.fieldItemData>
                { tab: "${tableTxt}", key: "${tableItemName}"},
            </#list>
        </#if>
    </#if>
]

const operation = [
    {
        title: '操作',
        align: 'center',
        key: 'actions',
        width: 100,
        fixed: 'right',
        slots: {
            default: 'actions'
         }
    }
];

<#if multiSub == true>
const subTableColumns = {
    <#if itemList??>
        <#list itemList as item>
            <#assign tableItemName = item.tableItemName>
            <#assign fieldItemData = item.fieldItemData>
            ${tableItemName}: [
            <#if fieldItemData??>
                <#list fieldItemData as itemData>
                    <#assign fieldName = itemData.dbFieldName>
                    <#assign fieldShowName = itemData.fieldShowName>
                    <#assign fieldShowType = itemData.fieldShowType>
                    <#assign isShowList = itemData.isShowList>
                    <#assign isShowForm = itemData.isShowForm>
                    <#assign fieldMustInput = itemData.fieldMustInput>
                    <#assign dictOriginType = itemData.dictOriginType>
                    <#if isShowList == true && fieldShowType?has_content>
                        <#switch fieldShowType>
                        <#case "1">
                        <#case "2">
                        <#case "3">
                        <#case "10">
                        <#case "11">
                            {
                                title: '${fieldShowName}',
                                align: 'center',
                                key: '${fieldName}',
                                formatter: ({cellValue, row}) => {
                                  return <#if dictOriginType == "1">row.${fieldName}_dictText<#elseif dictOriginType == "2">row.${fieldName}_realText<#else>cellValue</#if> || '--';
                                }
                            },
                            <#break>
                            <#case "5">
                            <#case "6">
                            <#case "7">
                                {
                                    title: '${fieldShowName}',
                                    align: 'center',
                                    key: '${fieldName}',
                                    formatter: ({cellValue, row}) => {
                                        return cellValue || '--';
                                    }
                                },
                                <#break>
                        <#case "13">
                        <#case "14">
                            {
                                title: '${fieldShowName}',
                                align: 'center',
                                key: '${fieldName}',
                                formatter: ({cellValue, row}) => {
                                        return row.${fieldName}_realText || '--';
                                }
                            },
                        <#break>
                        <#case "15">
                         {
                                title: '${fieldShowName}',
                                align: 'center',
                                key: '${fieldName}',
                                formatter: ({cellValue, row}) => {
                                  return row.${fieldName}_dictText
                                }
                            },
                            <#break>
                        </#switch>
                    </#if>
                </#list>
                ...operation,
            </#if>
            ],
        </#list>
    </#if>
}
</#if>

<#if  multiSub == false>
const subTableColumns = [
    <#if itemList??>
            <#list itemList as item>
                <#assign fieldItemData = item.fieldItemData>
                <#if fieldItemData??>
                    <#list fieldItemData as itemData>
                        <#assign fieldName = itemData.dbFieldName>
                        <#assign fieldShowName = itemData.fieldShowName>
                        <#assign fieldShowType = itemData.fieldShowType>
                        <#assign isShowList = itemData.isShowList>
                        <#assign isShowForm = itemData.isShowForm>
                        <#assign fieldMustInput = itemData.fieldMustInput>
                        <#assign dictOriginType = itemData.dictOriginType>
                        <#if isShowList == true && fieldShowType?has_content>
                            <#switch fieldShowType>
                                <#case "1">
                                <#case "2">
                                <#case "3">
                                <#case "10">
                                <#case "11">
                                    {
                                        title: '${fieldShowName}',
                                        align: 'center',
                                        key: '${fieldName}',
                                        formatter: ({cellValue, row}) => {
                                        return <#if dictOriginType == "1">row.${fieldName}_dictText<#elseif dictOriginType == "2">row.${fieldName}_realText<#else>cellValue</#if> || '--';
                                        }
                                    },
                                    <#break>
                                <#case "5">
                                <#case "7">
                                    {
                                        title: '${fieldShowName}',
                                        align: 'center',
                                        dataIndex: '${fieldName}',
                                        formatter: ({cellValue, row}) => {
                                            return cellValue || '--';
                                        }
                                    },
                                    <#break>
                                <#--                // 日期(yyyy)-->
                                <#case "6">
                                    {
                                        title: '${fieldShowName}',
                                        align: 'center',
                                        dataIndex: '${fieldName}',
                                        formatter: ({cellValue, row}) => {
                                            return cellValue || '--';
                                        }
                                    },
                                    <#break>
                                <#case "13">
                                <#case "14">
                                    {
                                        title: '${fieldShowName}',
                                        align: 'center',
                                        key: '${fieldName}',
                                        formatter: ({cellValue, row}) => {
                                                return row.${fieldName}_realText || '--';
                                        }
                                    },
                                    <#break>
                                     <#case "15">
                                    {
                                        title: '${fieldShowName}',
                                        align: 'center',
                                        key: '${fieldName}',
                                        formatter: ({cellValue, row}) => {
                                            return row.${fieldName}_dictText
                                        }
                                    },
                                <#break>
                            </#switch>
                        </#if>
                    </#list>
                    ...operation,
                </#if>
            </#list>
    </#if>
]
</#if>



 const tableColumns = [
<#list fieldData as item>
    <#assign fieldShowName = item.fieldShowName>
    <#assign fieldName = item.dbFieldName>
    <#assign fieldShowType = item.fieldShowType>
    <#assign isQuery = item.isQuery>
    <#assign isShowList = item.isShowList>
    <#assign dictOriginType = item.dictOriginType>
    <#assign dictKey = item.dictKey>
    <#if isShowList == true && fieldShowType?has_content>
        <#switch fieldShowType>
        <#--            // 文本框-->
            <#case "1">
                {
                    title: '${fieldShowName}',
                    align: 'center',
                    key: '${fieldName}',
                    dataType: 'text',
                    matchType: 'contain',
                    defaultSearchFlag: <#if isQuery>1<#else>0</#if>,
                    searchFlag: <#if isQuery>1<#else>0</#if>,
                    minWidth: 120,
                    sortAble: 1,
                    formatter: ({cellValue, row}) => {
                        return cellValue || '--';
                    }
                },
                <#break>
            <#--                // 单选框-->
            <#case "2">
                {
                    title: '${fieldShowName}',
                    align: 'center',
                    key: '${fieldName}',
                    dataType: <#if dictOriginType == "1">'dict'<#elseif dictOriginType == "2">'select'<#else>'select'</#if>,
                    matchType: 'equal',
                    defaultSearchFlag: <#if isQuery>1<#else>0</#if>,
                    searchFlag: <#if isQuery>1<#else>0</#if>,
                    minWidth: 120,
                    sortAble: 1,
                    options:{
                        <#if dictOriginType == "1"><#assign dictCode = item.dictField>dictCode: '${dictCode}',</#if>
                        <#if dictOriginType == "2">options: [],</#if>
                    },
                    formatter: ({cellValue, row}) => {
                        return <#if dictOriginType == "1">row.${fieldName}_dictText<#elseif dictOriginType == "2">row.${fieldName}_realText<#else>cellValue</#if> || '--';
                    }
                },
                <#break>
            <#--                // 多选框-->
            <#case "3">
                {
                    title: '${fieldShowName}',
                    align: 'center',
                    key: '${fieldName}',
                    dataType: <#if dictOriginType == "1">'multipleDict'<#elseif dictOriginType == "2">'multipleSelect'<#else>'select'</#if>,
                    matchType: 'contain',
                    defaultSearchFlag: <#if isQuery>1<#else>0</#if>,
                    searchFlag: <#if isQuery>1<#else>0</#if>,
                    sortAble: 1,
                    minWidth: 150,
                    options: {
                        mode: "multiple",
                        <#if dictOriginType == "1"><#assign dictCode = item.dictField>dictCode: '${dictCode}',</#if>
                        <#if dictOriginType == "2">options: [],</#if>
                    },
                    formatter: ({cellValue, row}) => {
                                return <#if dictOriginType == "1">row.${fieldName}_dictText<#elseif dictOriginType == "2">row.${fieldName}_realText<#else>cellValue</#if> || '--';
                    }
                },
                <#break>
             <#--                // 日期(yyyy-MM-dd)-->
            <#case "5">
                {
                    title: '${fieldShowName}',
                    align: 'center',
                    key: '${fieldName}',
                    dataType: 'dateRange',
                    matchType: 'range',
                    defaultSearchFlag: <#if isQuery>1<#else>0</#if>,
                    searchFlag: <#if isQuery>1<#else>0</#if>,
                    sortAble: 1,
                    minWidth: 120,
                    formatter: ({cellValue, row}) => {
                            return cellValue || '--';
                    }
                },
                <#break>
            <#--                // 日期(yyyy)-->
            <#case "6">
                {
                    title: '${fieldShowName}',
                    align: 'center',
                    key: '${fieldName}',
                    dataType: 'text',
                    matchType: 'contain',
                    defaultSearchFlag: <#if isQuery>1<#else>0</#if>,
                    searchFlag: <#if isQuery>1<#else>0</#if>,
                    sortAble: 1,
                    minWidth: 100,
                    formatter: ({cellValue, row}) => {
                            return cellValue || '--';
                    }
                },
                <#break>
                <#case "7">
                {
                    title: '${fieldShowName}',
                    align: 'center',
                    key: '${fieldName}',
                    dataType: 'dateTimeRange',
                    matchType: 'range',
                    defaultSearchFlag: <#if isQuery>1<#else>0</#if>,
                    searchFlag: <#if isQuery>1<#else>0</#if>,
                    sortAble: 1,
                    minWidth: 150,
                    formatter: ({cellValue, row}) => {
                            return cellValue || '--';
                    }
                },
            <#break>
            <#--                // 多行文本-->
            <#case "8">
                {
                    title: '${fieldShowName}',
                    align: 'center',
                    key: '${fieldName}',
                    dataType: 'text',
                    matchType: 'contain',
                    defaultSearchFlag: <#if isQuery>1<#else>0</#if>,
                    searchFlag: <#if isQuery>1<#else>0</#if>,
                    minWidth: 150,
                    sortAble: 1,
                    formatter: ({cellValue, row}) => {
                            return cellValue || '--';
                    }
                },
                <#break>
            <#--                // 下拉框-->
            <#case "10">
                {
                    title: '${fieldShowName}',
                    align: 'center',
                    key: '${fieldName}',
                    dataType: <#if dictOriginType == "1">'dict'<#elseif dictOriginType == "2">'select'<#else>'select'</#if>,
                    matchType: 'equal',
                    options: {
                        <#if dictOriginType == "1"><#assign dictCode = item.dictField>dictCode: '${dictCode}',</#if>
                        <#if dictOriginType == "2">options: [],</#if>
                    },
                    defaultSearchFlag: <#if isQuery>1<#else>0</#if>,
                    searchFlag: <#if isQuery>1<#else>0</#if>,
                     minWidth: 120,
                     sortAble: 1,
                    formatter: ({cellValue, row}) => {
                        return <#if dictOriginType == "1">row.${fieldName}_dictText<#elseif dictOriginType == "2">row.${fieldName}_realText<#else>cellValue</#if> || '--';
                    }
                },
                <#break>
            <#--                // 下拉多选-->
            <#case "11">
                {
                    title: '${fieldShowName}',
                    align: 'center',
                    key: '${fieldName}',
                    dataType: <#if dictOriginType == "1">'multipleDict'<#elseif dictOriginType == "2">'multipleSelect'<#else>'select'</#if>,
                    matchType: 'contain',
                    defaultSearchFlag: <#if isQuery>1<#else>0</#if>,
                    searchFlag: <#if isQuery>1<#else>0</#if>,
                    sortAble: 1,
                    minWidth: 150,
                    options: {
                        mode: "multiple",
                        <#if dictOriginType == "1"><#assign dictCode = item.dictField>dictCode: '${dictCode}',</#if>
                        <#if dictOriginType == "2">options: [],</#if>
                    },
                    formatter: ({cellValue, row}) => {
                                return <#if dictOriginType == "1">row.${fieldName}_dictText<#elseif dictOriginType == "2">row.${fieldName}_realText<#else>cellValue</#if> || '--';
                    }
                },
                <#break>
            <#--                // 数值-->
            <#case "12">
                {
                    title: '${fieldShowName}',
                    align: 'center',
                    dataIndex: '${fieldName}',
                    key: '${fieldName}',
                    dataType: 'number',
                    matchType: 'equal',
                    defaultSearchFlag: <#if isQuery>1<#else>0</#if>,
                    searchFlag: <#if isQuery>1<#else>0</#if>,
                    sortAble: 1,
                    minWidth: 100,
                    formatter: ({cellValue, row}) => {
                            return cellValue;
                    }
                },
                <#break>
            <#--                // 人员选择-->
            <#case "13">
                {
                    title: '${fieldShowName}',
                    align: 'center',
                    key: '${fieldName}',
                    dataType: 'select',
                    matchType: 'equal',
                    defaultSearchFlag: <#if isQuery>1<#else>0</#if>,
                    searchFlag: <#if isQuery>1<#else>0</#if>,
                    minWidth: 100,
                    sortAble: 1,
                    options: {
                        options:[]
                    },
                    formatter: ({cellValue, row}) => {
                            return row.${fieldName}_realText || '--';
                    }
                },
                <#break>
            <#--                // 部门选择-->
            <#case "14">
                {
                    title: '${fieldShowName}',
                    align: 'center',
                    key: '${fieldName}',
                    dataType: 'select',
                    matchType: 'equal',
                    defaultSearchFlag: <#if isQuery>1<#else>0</#if>,
                    searchFlag: <#if isQuery>1<#else>0</#if>,
                    minWidth: 120,
                    sortAble: 1,
                    options: {
                        options:[]
                    },
                    formatter: ({cellValue, row}) => {
                            return row.${fieldName}_realText || '--';
                    }
                },
                <#break>
                <#case "15">
                {
                    title: '${fieldShowName}',
                    align: 'center',
                    key: '${fieldName}',
                    dataType: 'userDict',
                    matchType: 'equal',
                    defaultSearchFlag: <#if isQuery>1<#else>0</#if>,
                    searchFlag: <#if isQuery>1<#else>0</#if>,
                     minWidth: 120,
                     sortAble: 1,
                    formatter: ({cellValue, row}) => {
                        return row.${fieldName}_dictText;
                    }
                },
                <#break>
        </#switch>
    </#if>
</#list>
...operation,
];
export {
subTableFormOptions,
    tabPane,
    subTableColumns,
tableColumns,
}